import * as CONSTANT from '../constants'
import { fromJS } from 'immutable'

const defaultState = fromJS({
    city : "",
    hasNextPage:true,
    news_list :[] ,
    pageNum:1,
    nextPage:2
  
    
    
    
})

export default (state = defaultState ,action) => {
    switch (action.type) {
        case CONSTANT.SETNC:
            return state.set('city',action.city)
        case  CONSTANT.SETNI:
            return state.merge({
                hasNextPage:action.hasNextPage,
                news_list :action.news_list,
                pageNum:action.pageNum,
                nextPage:action.nextPage
  
            })
        default:
            return state
            
    }
}